limsQualitycontrolTestResult.editPage = {

    getGridParam : function() {
        var _this = this;
        return {
            type : 'grid',
            id : 'lims-qualitycontrol-test-result-edit-list-grid',
            url : limsQualitycontrolTestResult.baseUrl + '/queries/raw',
            service : 'limsQualitycontrolTestResultServiceImpl',
            dbTable : 'T_LIMS_QUALITYCONTROL_TEST_RESULT',
            columns : limsQualitycontrolTestResult.getEditListColumns(),
            onCellClick : function(field, row) {
                field === 'id' && _this.loadDetailPage(row.id);
            },
            toolbar : [ {
                type : 'button',
                text : 'GIKAM.BUTTON.INSERT',
                icon : 'add',
                onClick : function() {
                    Gikam.preInsert({
                        modalTitle : 'BASELINE.BASEDATA.QUALITYCONTROLRESULTS.MODAL.ADD',
                        fields : limsQualitycontrolTestResult.getBaseInfoFormFields(),
                        url : limsQualitycontrolTestResult.baseUrl
                    }).done(function(id) {
                        Gikam.getComp('lims-qualitycontrol-test-result-edit-list-grid').refresh();
                    });
                }
            }, {
                type : 'button',
                text : 'GIKAM.BUTTON.DELETE',
                icon : 'remove-row',
                onClick : function() {
                    Gikam.getComp('lims-qualitycontrol-test-result-edit-list-grid').deleteRows(limsQualitycontrolTestResult.baseUrl);
                }
            } ]
        }
    },

    loadDetailPage : function(id) {
        workspace.window.load(limsQualitycontrolTestResult.baseUrl + '/page/detail' + Gikam.param({
            id : id
        }));
    },

    create : function() {
        var _this = this;
        Gikam.create('layout', {
            id : 'lims-qualitycontrol-test-result-edit-list-layout',
            renderTo : workspace.window.$dom,
            center : {
                items : [ this.getGridParam() ]
            }
        });
    },

    init : function() {
        this.create();
    }
};
